
--天赋按钮
local normal_icon = [[UI\Console\Human\human-transport-slot.blp]]
class.card_button = extends(class.button) {
    reload = true,

    new = function (parent,x,y,w,h)
        local panel = class.card_button:builder 
        {
            parent = parent,
            x = x,
            y = y,
            w = w,
            h = h,
        }
        return panel
    end,
    init = function (self)
        class.button.init(self)

        self:set_normal_image(normal_icon)
        self:set_highlight([[UI\Buttons\HeroLevel\HeroLevel-Border.blp]])

        --左上角标题
        self.title = self:add_panel([[core/bantouming.blp]],0,0,35,20)
        self.title.text = self.title:add_text('名称',0,0,self.w,nil,8,4)
        
        --下方计数
        -- self.overlay = self:add_number_panel((self.w-36),self.h-32,36,32)
        -- self.overlay:hide()

        --组合图标

        --冷却闪光
        self.cooldown = self:child_builder {
            parent = self,
            type = 'model',
            model = [[UI\Feedback\Cooldown\UI-Cooldown-Indicator.mdx]],
            scales = {self.w / 92,self.h / 67},
            show_flag = false,
            animation = 'stand',
        }

        return self
    end,
    set_data = function(self,skill)
        if self.skill~=skill then
            self.cooldown:set_animation_by_index(1)
            self.cooldown:show()
        end
        self.skill = skill
        if skill then
            if skill.show_class==nil or skill.show_class=='' then
                self.title:hide()
            else
                self.title.text:set_text(skill.show_class)
                self.title:show()
            end
            self:set_normal_image(skill.art)

        else
            self:set_normal_image(normal_icon)
            self.title:hide()
        end
    end,
}